<?php
header("Content-Type:text/html;charset=utf-8");
require_once('array.php');
require("PHPMailer/class.phpmailer.php"); //下载的文件必须放在该文件所在目录
$mail = new PHPMailer(); //建立邮件发送类
$address = $_GET['email'];
$smtp = $mail_array[1]['smtp'];
$fromail = $mail_array[1]['mail_address'];
$mailpwd = $mail_array[1]['mail_pwd'];


$mail->IsSMTP(); // 使用SMTP方式发送
$mail->Host = $smtp; // 您的企业邮局域名
$mail->SMTPAuth = true; // 启用SMTP验证功能
$mail->Username = $fromail; // 邮局用户名(请填写完整的email地址)
$mail->Password = $mailpwd; // 邮局密码
$mail->Port=25;
$mail->From = $fromail; //邮件发送者email地址
$mail->FromName = $fromName;
$mail->AddAddress("$address", "xmltest");//收件人地址，可以替换成任何想要接收邮件的email信箱,格式是AddAddress("收件人email","收件人姓名")
//$mail->AddReplyTo("", "");

//$mail->AddAttachment("/var/tmp/file.tar.gz"); // 添加附件
//$mail->IsHTML(true); // set email format to HTML //是否使用HTML格式

$mail->Subject = $subject; //邮件标题
$body = file_get_contents("http://fbosc.cc/mail_template.php?email=".$address);
$body = preg_replace('/\\\\/','', $body);

//$mail->AltBody = "This is the body in plain text for non-HTML mail clients"; //附加信息，可以省略

$mail->MsgHTML($body);//发送HTML内容

$mail->IsHTML(true); // send as HTML
$mail->CharSet = "UTF-8";
$mail->Encoding = "base64";

if(!$mail->Send())
{
echo "邮件发送失败. <p>";
echo "错误原因: " . $mail->ErrorInfo;
exit;
}

echo "邮件发送成功";


